<template>
    <div class="search-bar">
        <input class="input-search" type="search" :placeholder="$t('workTodos.note.input.placeholder')" v-model="modelValue" @input="search"/>
        <v-icon class="icon-search" name="icon_search" :size="18"></v-icon>
    </div>
</template>

<script setup lang="ts">
const emit = defineEmits(['update:modelValue'])
const modelValue = ref<any>('');

const search = () => {
    emit('update:modelValue', modelValue.value)
}
</script>

<style lang="less" scoped>
.search-bar {
    position: relative;
    -webkit-app-region: no-drag;
    .input-search {
        width: 100%;
        height: 40px;
        outline: none;
        border: 1px solid #dcdfe6;
        border-radius: 18px;
        color: #606266;
        background-color: transparent;
        /* 输入框内文字与外框距离 */
        padding-left: 40px;
        padding-right: 10px;
        padding-top: 0px;
        font-size: 14px;
        cursor: pointer;
        transition: 0.1s;
        &:focus {
            border: 1px solid #ffc001;
            & +.icon-search{
                color: #ffc001;
            }
        } 
        &:hover {
            border: 1px solid #ffc001;
            & +.icon-search{
                color: #ffc001;
            }
        }
        &::placeholder{
            font-size: 14px;
        }
    }
    .icon-search {
        position: absolute;
        width: 20px;
        height: 20px;
        left: 15px;
        top: calc(50% - 10px);
        transition: all 0.1s;
        &:hover{
            color: #ffc001;
        }
    }
}
</style>